const express = require('express')
const app = express()

/* 连接数据库 */
var mysql = require('mysql');
var db = mysql.createConnection({
    host: 'localhost',
    user: 'root',
    password: 'root',
    database: 'bigevent'
});

app.use(express.static('./pages'))

app.get('/getData', (req, res) => {
    var sql = 'select *  from  pc'
    db.query(sql, (err, results) => {
        res.json(results)
    })
})
app.listen(2000, () => {
    console.log('服务器:http://127.0.0.1:2000')
})